package com.fintech.third.service.channel;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fintech.third.constant.ThirdProductChannelConstant;
import com.fintech.third.constant.ThirdProductConstant;
import com.fintech.third.dao.ThirdProductChannelMappper;
import com.fintech.third.model.ThirdProductChannel;
import com.marvels.common.utils.MarvelsLogUtil;

@Service("thirdChannelObtain")
public class ThirdChannelObtainImpl implements ThirdChannelObtainService {

	@Autowired
	private ThirdProductChannelMappper thirdProductChannelMappper;

	@Override
	public String AccumulationFundChannel() {

		ThirdProductChannel thirdProductChannel = new ThirdProductChannel();
		thirdProductChannel = thirdProductChannelMappper
				.queryAvailableChannel(ThirdProductConstant.AccumulationFund.getCode());
		return thirdProductChannel.getProduct_channel();
	}

	@Override
	public List<ThirdProductChannel> getSmsTotalChannelCode() {
		List<ThirdProductChannel> thirdProductChannelList = null;
		Map<String, Object> map = new HashMap<>();
		map.put("productCode", ThirdProductConstant.SMS.getCode());
		List<String> list = new ArrayList<>();
		list.add(ThirdProductChannelConstant.TENCENTSMS.getCode());// 除掉腾讯云短信
		list.add(ThirdProductChannelConstant.TRUETESTSMS.getCode());// 除掉中正云通讯短信
		map.put("list", list);
		try {
			thirdProductChannelList = thirdProductChannelMappper.querySmsProductChannel(map);
		} catch (Exception exception) {
			exception.printStackTrace();
			MarvelsLogUtil.getInstance().info("======查询所有短信通道异常:" + exception.getMessage());
		}
		return thirdProductChannelList;
	}

}
